package demo.icanci.proxy.impl;

import demo.icanci.proxy.ToBPayment;
import demo.icanci.proxy.ToCPayment;

/**
 * @author icanci
 * @date Created in 2021/03/03 00:41
 * @version 1.0
 */
public class AlipayToB implements ToBPayment {

    private ToCPayment toBPayment;

    public AlipayToB(ToCPayment toBPayment) {
        this.toBPayment = toBPayment;
    }

    @Override
    public void pay() {
        beforePay();
        toBPayment.pay();
        afterPay();
    }

    private void afterPay() {
        System.out.println("AliPayToC.afterPay  取钱");
    }

    private void beforePay() {
        System.out.println("AliPayToC.beforePay 付钱");
    }
}
